Repository navigation
Conversation
Contributor
|
This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and you aren't currently assigned to #1519. You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned. There's no need to open a new PR either way. Maintainers: reopen, remove |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1519
When the MCP server URL has a query string (for example
https://mcp.example.com/mcp?features=flags), the OAuth client used the full URL, query included, to build the protected resource metadata candidates and to compare against the metadata'sresource. A server that follows RFC 8707 section 2 publishes a resource without the query, so every candidate was rejected and the handler fell back to the server root.AuthorizationCodeHandler.getProtectedResourceMetadatanow clears the query and fragment from the server URL before it builds the well-known candidate URLs and before the resource comparison.Testing: added
TestGetProtectedResourceMetadata_QueryInServerURLinauth/authorization_code_test.go. It serves metadata whoseresourcehas no query and checks that a server URL ending in?features=flagsis accepted. The new test and theauthpackage tests pass.The OAuth client failed for MCP servers that put settings in the URL query, even when the server followed the RFC. I wanted this case to work like it does in the other official SDKs.